package com.tangfuzhong.proxy;



public class TestProxy {
    public static void main(String[] args) {
        MyProxy.HelloService target = new MyProxy.HelloServiceImpl();
        MyInterceptor transactionInterceptor = new TransactionInterceptor();
        target = (MyProxy.HelloService) transactionInterceptor.plugin(target);
        target.sayHello();

        target = new MyProxy.HelloServiceImpl();
        LogInterceptor logInterceptor = new LogInterceptor();
        target = (MyProxy.HelloService)logInterceptor.plugin(target);
        target.sayHello();
    }
}
